/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package specifications;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;

/**
 *
 * @author Jason
 */
public class TextualCharacteristics extends Parameter implements YamlObject<TextualCharacteristics> {
    public static final Tag TAG = new Tag("!TextualCharacteristics");
    private String language;
    private String region;
    private String textType;
    private String audience;
    private String purpose;

    public TextualCharacteristics(){}
    public TextualCharacteristics(String language,
                                  String region,
                                  String textType,
                                  String audience,
                                  String purpose){
        this.setPriority(20); // default priority
        this.language = language;
        this.region = region;
        this.textType = textType;
        this.audience = audience;
        this.purpose = purpose;
    }
    @Override
    public ArrayList<Directive> getDirectives() {
        return new ArrayList(0);
    }

    @Override
    public void dump(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileWriter writer = new FileWriter(filename);
        writer.write(yaml.dumpAs(this, TAG, DumperOptions.FlowStyle.BLOCK));
        writer.close();
    }

    @Override
    public TextualCharacteristics load(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileReader reader = new FileReader(filename);
        TextualCharacteristics param = yaml.loadAs(reader, TextualCharacteristics.class);
        reader.close();
        return param;
    }


    /**
     * @return the language
     */
    public String getLanguage() {
        return language;
    }

    /**
     * @param language the language to set
     */
    public void setLanguage(String language) {
        this.language = language;
    }

    /**
     * @return the region
     */
    public String getRegion() {
        return region;
    }

    /**
     * @param region the region to set
     */
    public void setRegion(String region) {
        this.region = region;
    }

    /**
     * @return the textType
     */
    public String getTextType() {
        return textType;
    }

    /**
     * @param textType the textType to set
     */
    public void setTextType(String textType) {
        this.textType = textType;
    }

    /**
     * @return the audience
     */
    public String getAudience() {
        return audience;
    }

    /**
     * @param audience the audience to set
     */
    public void setAudience(String audience) {
        this.audience = audience;
    }

    /**
     * @return the purpose
     */
    public String getPurpose() {
        return purpose;
    }

    /**
     * @param purpose the purpose to set
     */
    public void setPurpose(String purpose) {
        this.purpose = purpose;
    }
    
}
